; Remove any NVIDIA device driver if present

; echo Checking for SMBus device
enumregcmd HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{4D36E97D-E325-11CE-BFC1-08002BE10318}\{*},call CheckNVIDIAKeys

if {LeaveDriverStoreCache}=No then call DeviceRemoval

call FileDelete

[DeviceRemoval]
if {OS}=WinME then set RemoveDeviceStyle=Win9x
if {LeaveDriverStoreCache}=No then RemoveDeviceEx pci,VEN_10DE&DEV_0034,System
if {LeaveDriverStoreCache}=No then RemoveDeviceEx pci,VEN_10DE&DEV_0052,System
if {LeaveDriverStoreCache}=No then RemoveDeviceEx pci,VEN_10DE&DEV_005D,System
if {LeaveDriverStoreCache}=No then RemoveDeviceEx pci,VEN_10DE&DEV_005E,System
if {LeaveDriverStoreCache}=No then RemoveDeviceEx pci,VEN_10DE&DEV_0064,System
if {LeaveDriverStoreCache}=No then RemoveDeviceEx pci,VEN_10DE&DEV_007B,System
if {LeaveDriverStoreCache}=No then RemoveDeviceEx pci,VEN_10DE&DEV_007D,System
if {LeaveDriverStoreCache}=No then RemoveDeviceEx pci,VEN_10DE&DEV_0084,System
if {LeaveDriverStoreCache}=No then RemoveDeviceEx pci,VEN_10DE&DEV_00A4,System
if {LeaveDriverStoreCache}=No then RemoveDeviceEx pci,VEN_10DE&DEV_00D3,System
if {LeaveDriverStoreCache}=No then RemoveDeviceEx pci,VEN_10DE&DEV_00D4,System
if {LeaveDriverStoreCache}=No then RemoveDeviceEx pci,VEN_10DE&DEV_00E4,System
if {LeaveDriverStoreCache}=No then RemoveDeviceEx pci,VEN_10DE&DEV_01B4,System
if {LeaveDriverStoreCache}=No then RemoveDeviceEx pci,VEN_10DE&DEV_0264,System
if {LeaveDriverStoreCache}=No then RemoveDeviceEx pci,VEN_10DE&DEV_02F0,System
if {LeaveDriverStoreCache}=No then RemoveDeviceEx pci,VEN_10DE&DEV_02FE,System
if {LeaveDriverStoreCache}=No then RemoveDeviceEx pci,VEN_10DE&DEV_02F8,System
if {LeaveDriverStoreCache}=No then RemoveDeviceEx pci,VEN_10DE&DEV_02F9,System
if {LeaveDriverStoreCache}=No then RemoveDeviceEx pci,VEN_10DE&DEV_027E,System
if {LeaveDriverStoreCache}=No then RemoveDeviceEx pci,VEN_10DE&DEV_027F,System
if {LeaveDriverStoreCache}=No then RemoveDeviceEx pci,VEN_10DE&DEV_02FF,System
if {LeaveDriverStoreCache}=No then RemoveDeviceEx pci,VEN_10DE&DEV_0270,System
if {LeaveDriverStoreCache}=No then RemoveDeviceEx pci,VEN_10DE&DEV_0272,System
if {LeaveDriverStoreCache}=No then RemoveDeviceEx pci,VEN_10DE&DEV_02FA,System
if {LeaveDriverStoreCache}=No then RemoveDeviceEx pci,VEN_10DE&DEV_0368,System
if {LeaveDriverStoreCache}=No then RemoveDeviceEx pci,VEN_10DE&DEV_03EB,System
if {LeaveDriverStoreCache}=No then RemoveDeviceEx pci,VEN_10DE&DEV_0446,System
if {LeaveDriverStoreCache}=No then RemoveDeviceEx pci,VEN_10DE&DEV_0752,System
if {LeaveDriverStoreCache}=No then RemoveDeviceEx pci,VEN_10DE&DEV_078F,System
if {LeaveDriverStoreCache}=No then RemoveDeviceEx pci,VEN_10DE&DEV_07D8,System
if {LeaveDriverStoreCache}=No then RemoveDeviceEx pci,VEN_10DE&DEV_0AA2,System
if {LeaveDriverStoreCache}=No then RemoveDeviceEx pci,VEN_10DE&DEV_0BBB,System
if {LeaveDriverStoreCache}=No then RemoveDeviceEx pci,VEN_10DE&DEV_0C54,System
if {LeaveDriverStoreCache}=No then RemoveDeviceEx pci,VEN_10DE&DEV_0C94,System
if {LeaveDriverStoreCache}=No then RemoveDeviceEx pci,VEN_10DE&DEV_0542,System
if {LeaveDriverStoreCache}=No then RemoveDeviceEx pci,VEN_10DE&DEV_0D79,System

if {LeaveDriverStoreCache}=No then RemoveDriverStore {windir}\Inf\{InfPath}

if {OS}=WinME then set RemoveDeviceStyle

[CheckNVIDIAKeys]
set DriverDesc=FOOBAR
GetReg DriverDesc={Current Root Key}\{Current Reg Key}\DriverDesc
if {DriverDesc}%NVIDIA nForce PCI System Management then GetReg InfPath={Current Root Key}\{Current Reg Key}\InfPath

[FileDelete]

; Now try to delete files used by System Management Bus driver
if {LeaveDriverStoreCache}=No then DelOemInfs nv*,version,Provider,%Nvidia%,version,CatalogFile,nvsmb.cat
if {LeaveDriverStoreCache}=No then DelOemInfs nv*,version,Provider,%NVIDIA%,version,CatalogFile,nfsmb64.cat
if {LeaveDriverStoreCache}=No then DelOemInfs nv*,version,Provider,%NV%,version,CatalogFile,nf4sys.cat
if {LeaveDriverStoreCache}=No then DelOemInfs nv*,version,Provider,%NVDA%,version,CatalogFile,nf4pcie.cat

Del {sysdir}\nvsmbus.inf
Del {windir}\INF\INTERNET\NVIDIAnvsmbus.inf

; also delete its uninstaller binary
set DelCmd=delbootquiet
if {LeaveDriverStoreCache}=No then set DelCmd=delboot
{DelCmd} {sysdir}\nvusmb.exe

; and delete the coinstaller binary
{DelCmd} {sysdir}\nvcosmb.dll

Del {windir}\APPLOG\NVUSMB.LGD
Del {windir}\APPLOG\NVUSMB.LGC
Del {windir}\APPLOG\NVUNINST.LGD
Del {windir}\APPLOG\NVUNINST.LGC
